package com.log.controller;

import com.log.common.vo.ResultVo;
import com.log.pojo.LogEmployeer;
import com.log.service.LogEmployeerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
//123
@RestController
@RequestMapping("/employeer")
@Api(tags = "员工管理",value = "员工的增删改查，运用了RESTful接口规范")
public class LogEmployeerController {
    @Autowired
    private LogEmployeerService logEmployeerService;
    @GetMapping("/selectbypage")
    @ApiOperation("分页查询")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(dataType = "int",name = "pageNum",value = "当前的页数",required = true),
                    @ApiImplicitParam(dataType = "int",name = "limit",value = "每页查询的页数",required = true)
            }
    )
    public ResultVo selectempbyid(int pageNum,int limit){
        return  logEmployeerService.selectLogEmployeerListByPage(pageNum,limit);
    }
    @ApiOperation("通过员工id查询员工信息")
    @GetMapping("/selectbyid")
    public ResultVo getempid(int id){

        return logEmployeerService.getLogEmployeerById(id);
    }
    @ApiOperation("通过员工id删除员工")
    @GetMapping("/deletebyid")
    public ResultVo deleteempid(int id){

        return  logEmployeerService.deleteLogEmployeerById(id);
    }
    @ApiOperation("添加员工信息")
    @PostMapping("/insertemployeer")
    public ResultVo insertEmployeer(@RequestBody LogEmployeer logEmployeer){
        return logEmployeerService.insertLogEmployeerById(logEmployeer);
    }
    @ApiOperation("修改员工信息")
    @PutMapping("/updateemployeer")
    public ResultVo updateemp(@RequestBody LogEmployeer logEmployeer){
        return logEmployeerService.updateLogEmployeer(logEmployeer);
    }

    @ApiImplicitParams(
            {
                    @ApiImplicitParam(dataType = "int",name = "pageNum",value = "当前的页码",required = true),
                    @ApiImplicitParam(dataType = "int",name = "limit",value = "每页显示条数",required = true),

            }
    )
    @ApiOperation("通过状态查询司机")
    @GetMapping("/selectbystate")
    public ResultVo selectbyempstate(int pageNum,int limit,int state){
        return logEmployeerService.getAllLogEmployeerInfoByPageAndStatus(pageNum,limit,state);
    }
}
